SPA_RESOLVE_INIT = function(transition) {
    var html = '<div class="right-list-box addhomework-box mt-20 pb-150 magin-auto">\n' +
        '<div class="items">\n' +
        '<label>标题：</label>\n' +
        '<input type="text" class="t t1 rad-3 ml-10 f-14" maxlength="20" id="questionTitle">\n' +
        // '<select class="rad-3 t t3 ml-10 f-14" id="relateCourse">\n' +
        // '          <option selected value="">--选择--</option>\n' +
        // '        </select>\n' +
        '<!-- <a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center">添加</a> -->\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>相关课程：</label>\n' +
        '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="20" id="relateCourse">\n' +
        '<label>章节：</label>\n' +
        '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="20" id="relateChapter">' +
        '</div>        \n' +
        '<div class="items">\n' +
        '<label>难度：</label>\n' +
        '<select class="rad-3 t t3 ml-10 f-14" id="questionDifficulty">\n' +
        '<option>--请选择--</option>\n' +
        ' <option value="1">1</option>\n' +
        '          <option value="2">2</option>\n' +
        '          <option value="3">3</option>\n' +
        '          <option value="4">4</option>\n' +
        '</select>\n' +
        '<label>分值：</label>\n' +
        '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="3" id="score">\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>题目类型：</label>\n' +
        '<select class="rad-3 t t3 ml-10 f-14" id="questionType" onchange="changequestionType(this)">\n' +
        '<option>--请选择--</option>\n' +
        '<option value="1">填空题</option>\n' +
        '<option value="2">选择题</option>\n' +
        '<option value="3">判断题</option>\n' +
        '<option value="4">程序填空题</option>\n' +
        '<option value="5">程序改错题</option>\n' +
        '<option value="6">编程题</option>' +
        '</select>\n' +
        '</div>' +
        '<div id="addproblemCont">' +
        '</div>' +
        '</div> ';
    getHref_path();
    $(".menu ul").hide();
    $(".menu ul").eq(2).show();
    document.getElementById("ui-right-content").innerHTML = html;
}

//选择题
var html_choice='<div class="items">\n' +
    '<label>描述：</label>\n' +
    '<textarea class="choice-explain t4 rad-3 ml-10 pt-5 f-14 questionDescription" maxlength="300" id="questionDescription"></textarea>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>正确答案：</label>\n' +
    '<input type="text" class="rightAns t t1 rad-3 ml-10 f-14" maxlength="20" id="rightAns">\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>错误答案：</label>\n' +
    '<input type="text" class="wrongAns t t1 rad-3 ml-10 f-14" maxlength="20">\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label></label>\n' +
    '<input type="text" class="wrongAns t t1 rad-3 ml-10 f-14" maxlength="20">\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label></label>\n' +
    '<input type="text" class="wrongAns t t1 rad-3 ml-10 f-14" maxlength="20">\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="submitChoiceFun()">提交</a>\n' +
    '</div>\n' +
    '</div> ';
//判断题
var html_judge='<div class="items">\n' +
    '<label>描述：</label>\n' +
    '<textarea class="choice-explain t4 rad-3 ml-10 pt-5 f-14" maxlength="300" id="questionDescription"></textarea>\n' +
    '</div>\n' +
    '\n' +
    '<div class="items">\n' +
    '<label>答案：</label>\n' +
    '<span class="ml-10"><input type="radio" name="answer" value="1"/>&ensp;True</span>\n' +
    '<span><input type="radio" name="answer" value="0"/>&ensp;False</span>\n' +
    '</div>\n' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="submitJudgeFun()">提交</a>\n' +
    '</div>\n';
//填空题
var html_blank='<div class="items">\n' +
    '<label>空格个数：</label>\n' +
    '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="20" onchange="blanknumChangs(this)" value="1" id="">' +
    '</div>\n' +
    '<div id="blankCont">' +
    '<div class="items">\n' +
    '<label>描述：</label>\n' +
    '<textarea class="choice-explain t4 rad-3 ml-10 pt-5 f-14 BlankDes" maxlength="300"></textarea>\n' +
    '</div>\n' +
        '<div class="oneblank">' +
        '<div class="items">\n' +
        '<label>答案：</label>\n' +
        '<input type="text" class="t t1 rad-3 ml-10 f-14 BlankAns" maxlength="100">\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>描述：</label>\n' +
        '<textarea class="choice-explain t4 rad-3 ml-10 pt-5 f-14 BlankDes" maxlength="300"></textarea>\n' +
        '</div>' +
        '</div>' +
    '</div>' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="blankSubmit()">提交</a>\n' +
    '</div>\n';

function blanknumChangs(obj){
    var blanknum=$(obj).val()
    var oldBlanknum=$("#blankCont .oneblank").length
    if(blanknum<1){
        $.message("请填写正确的空格数量")
        return
    }
    if(blanknum>oldBlanknum){
        blankAdd(blanknum-oldBlanknum)
    }
    else if(blanknum<oldBlanknum){
        blankDelete(oldBlanknum-blanknum)
    }
}
function blankDelete(n) {
    for(var i=0;i<n;i++){
        $("#blankCont .oneblank").eq(-1).remove()
    }
}
function blankAdd(n) {
    var oneblank_html=        '<div class="oneblank">' +
        '<div class="items">\n' +
        '<label>答案：</label>\n' +
        '<input type="text" class="t t1 rad-3 ml-10 f-14 BlankAns" maxlength="100">\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>描述：</label>\n' +
        '<textarea class="choice-explain t4 rad-3 ml-10 pt-5 f-14 BlankDes" maxlength="300"></textarea>\n' +
        '</div>' +
        '</div>' ;
    for(var i=0;i<n;i++){
        $("#blankCont").append(oneblank_html)
    }
}

//程序填空题
var html_procedureBlank='<div class="items">\n' +
    '<label>空格个数：</label>\n' +
    '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="3" value="1" onchange="procedureblanknumChangs(this)" class="blankNumber">   \n' +
    '</div>\n' +
    '<div id="procedureBlankCont">' +
    '<div class="items">\n' +
    '<label>代码段：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14 BlankDes"></textarea>\n' +
    '</div>\n' +
    '<div class="oneProcedureBlank">' +
    '<div class="oneProcedureBlankCont">' +
    '<div class="items">' +
    '<label>空格：</label>' +
    '<input type="text" class="t t1 rad-3 ml-10 f-14 BlankAns"/>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label></label>\n' +
    '<label>关键字：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>关键字</td><td>分值</td></tr></thead>\n' +
    '<tbody class="keywordTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr key"></td>\n' +
    '<td><input type="number" class="sr val"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="keywordChangs(this)" value="1" />\n' +
    '</div>\n' +
    '</div>\n' +
    '<div class="items">' +
    '<label>代码段：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14 BlankDes"></textarea>\n' +
    '</div>' +
    '</div>' +
    '</div>' +
    '<div class="items">\n' +
    '<label>测试数据：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>输入</td><td>输出</td></tr></thead>\n' +
    '<tbody id="testdataTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr inputs"></td>\n' +
    '<td><input type="text" class="sr outputs"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="testdatanumChangs(this)" value="1" />\n' +
    '</div>' +
    '<div class="items thefile">\n' +
    '<label>文件：</label>\n' +
    '<input id="filename" type="text" class="t t3 rad-3 ml-10 f-14 outline-none c-666 filename" readonly/>\n' +
    '<div class="upload-box relative bg-169 text-center c-fff f-14 rad-3 ml-10">\n' +
    '选择文件<input id="fileInput" type="file" name="files" onchange="fileinput(this)" class="absolute pointer fileinputs"/>\n' +
    '</div>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center">上传</a>\n' +
    '</div>\n' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="procedureBlankSubmit()">提交</a>\n' +
    '</div>\n';
var html_procedureError='<div class="items">\n' +
    '<label>空格个数：</label>\n' +
    '<input type="number" class="t t3 rad-3 ml-10 f-14" maxlength="3" value="1" onchange="procedureblanknumChangs(this)" class="blankNumber">   \n' +
    '</div>\n' +
    '<div id="procedureBlankCont">' +
    '<div class="items">\n' +
    '<label>代码段：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14"></textarea>\n' +
    '</div>\n' +
    '<div class="oneProcedureBlank">' +
    '<div class="oneProcedureBlankCont">' +
    '<div class="items">' +
    '<label>错误段：</label>' +
    '<input type="text" class="t t1 rad-3 ml-10 f-14"/>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label></label>\n' +
    '<label>关键字：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>关键字</td><td>分值</td></tr></thead>\n' +
    '<tbody class="keywordTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr key"></td>\n' +
    '<td><input type="number" class="sr val"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="keywordChangs(this)" value="1" />\n' +
    '</div>\n' +
    '</div>\n' +
    '<div class="items">' +
    '<label>代码段：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14"></textarea>\n' +
    '</div>' +
    '</div>' +
    '</div>' +
    '<div class="items">\n' +
    '<label>测试数据：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>输入</td><td>输出</td></tr></thead>\n' +
    '<tbody id="testdataTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr inputs"></td>\n' +
    '<td><input type="text" class="sr outputs"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="testdatanumChangs(this)" value="1" />\n' +
    '</div>' +
    '<div class="items thefile">\n' +
    '<label>文件：</label>\n' +
    '<input id="filename" type="text" class="t t3 rad-3 ml-10 f-14 outline-none c-666 filename" readonly/>\n' +
    '<div class="upload-box relative bg-169 text-center c-fff f-14 rad-3 ml-10">\n' +
    '选择文件<input id="fileInput" type="file" name="files" onchange="fileinput(this)" class="absolute pointer fileinputs"/>\n' +
    '</div>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center">上传</a>\n' +
    '</div>\n' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="submitProBlabkFun()">提交</a>\n' +
    '</div>\n';

function procedureblanknumChangs(obj){
    var blanknum=$(obj).val()
    var oldBlanknum=$("#procedureBlankCont .oneProcedureBlank").length
    if(blanknum<1){
        $.message("请填写正确的空格数量")
        return
    }
    if(blanknum>oldBlanknum){
        procedureblankAdd(blanknum-oldBlanknum)
    }
    else if(blanknum<oldBlanknum){
        procedureblankDelete(oldBlanknum-blanknum)
    }
}
function procedureblankDelete(n) {
    for(var i=0;i<n;i++){
        $("#procedureBlankCont .oneProcedureBlank").eq(-1).remove()
    }
}
function procedureblankAdd(n) {
    var oneblank_html=    '<div class="oneProcedureBlank">' +
        '<div class="oneProcedureBlankCont">' +
        '<div class="items">' +
        '<label>空格：</label>' +
        '<input type="text" class="t t1 rad-3 ml-10 f-14 BlankAns"/>\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label></label>\n' +
        '<label>关键字：</label>\n' +
        '<table class="event-tables float-left ml-10">\n' +
        '<table class="event-tables float-left ml-10">\n' +
        '        <thead><tr><td>关键字</td><td>分值</td></tr></thead>\n' +
        '<tbody class="keywordTbody">\n' +
        '<tr>\n' +
        '<td><input type="text" class="sr key"></td>\n' +
        '<td><input type="number" class="sr val"></td>\n' +
        '</tr>\n' +
        '</tbody>\n' +
        '</table> \n' +
        '<label>数量：</label>\n' +
        '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="keywordChangs(this)" value="1" />\n' +
        '</div>\n' +
        '</div>\n' +
        '<div class="items">' +
        '<label>代码段：</label>\n' +
        '<textarea type="text" class="t t4 rad-3 ml-10 f-14 BlankDes"></textarea>\n' +
        '</div>' +
        '</div>' ;
    for(var i=0;i<n;i++){
        $("#procedureBlankCont").append(oneblank_html)
    }
}
//编程题
var html_desgin='<div class="items">\n' +
    '<label>描述：</label>\n' +
    '<textarea id="questionDescription" type="text" class="t t4 rad-3 ml-10 f-14" ></textarea>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>输入格式：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14"></textarea>\n' +
    '\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>输出格式：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14" ></textarea>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>样例输入：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14" ></textarea>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>样例输出：</label>\n' +
    '<textarea type="text" class="t t4 rad-3 ml-10 f-14" ></textarea>\n' +
    '</div>\n' +
    '\n' +
    '<div class="items thefile">\n' +
    '<label>文件：</label>\n' +
    '<input id="filename" type="text" class="t t3 rad-3 ml-10 f-14 outline-none c-666 filename" readonly/>\n' +
    '<div class="upload-box relative bg-169 text-center c-fff f-14 rad-3 ml-10">\n' +
    '选择文件<input id="fileInput" type="file" name="files" onchange="fileinput(this)" class="absolute pointer fileinputs"/>\n' +
    '</div>\n' +
    '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center">上传</a>\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>测试数据：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>输入</td><td>输出</td></tr></thead>\n' +
    '<tbody id="testdataTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr inputs"></td>\n' +
    '<td><input type="text" class="sr outputs"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="testdatanumChangs(this)" value="1" />\n' +
    '</div>' +
    '<div class="items">\n' +
    '<label>关键字：</label>\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '<table class="event-tables float-left ml-10">\n' +
    '        <thead><tr><td>关键字</td><td>分值</td></tr></thead>\n' +
    '<tbody class="keywordTbody">\n' +
    '<tr>\n' +
    '<td><input type="text" class="sr key"></td>\n' +
    '<td><input type="number" class="sr val"></td>\n' +
    '</tr>\n' +
    '</tbody>\n' +
    '</table> \n' +
    '<label>数量：</label>\n' +
    '<input type="number" class="t t5 rad-3 ml-10 f-14" onchange="keywordChangs(this)" value="1" />\n' +
    '</div>\n' +
    '<div class="items">\n' +
    '<label>提交次数：</label>\n' +
    '<input type="number" class="t t3 rad-3 ml-10 f-14" value="" />\n' +
    '</div>\n' +
    '<div class="items mt-35">\n' +
    '<label></label>\n' +
    '<a href="javascript:;" onclick="designSubmit()" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center">提交</a>\n' +
    '</div>\n';

function testdatanumChangs(obj){
    var blanknum=$(obj).val()
    var oldBlanknum=$("#testdataTbody tr").length
    if(blanknum<1){
        $.message("请填写正确的数量")
        return
    }
    if(blanknum>oldBlanknum){
        testdataAdd(blanknum-oldBlanknum)
    }
    else if(blanknum<oldBlanknum){
        testdataDelete(oldBlanknum-blanknum)
    }
}
function testdataDelete(n) {
    for(var i=0;i<n;i++){
        $("#testdataTbody tr").eq(-1).remove()
    }
}
function testdataAdd(n) {
    var oneblank_html=    '<tr>\n' +
        '<td><input type="text" class="sr inputs"></td>\n' +
        '<td><input type="text" class="sr outputs"></td>\n' +
        '</tr>\n' ;
    for(var i=0;i<n;i++){
        $("#testdataTbody").append(oneblank_html)
    }
}

function keywordChangs(obj){
    var blanknum=$(obj).val()
    var keywordTbody=$(obj).closest(".items").find(".keywordTbody")
    var oldBlanknum=$(keywordTbody).find("tr").length
    if(blanknum<1){
        $.message("请填写正确的数量")
        return
    }
    if(blanknum>oldBlanknum){
        keywordAdd(blanknum-oldBlanknum,keywordTbody)
    }
    else if(blanknum<oldBlanknum){
        keywordDelete(oldBlanknum-blanknum,keywordTbody)
    }
}
function keywordDelete(n,obj) {
    for(var i=0;i<n;i++){
        $(obj).find("tr").eq(-1).remove()
    }
}
function keywordAdd(n,obj) {
    var oneblank_html=    '<tr>\n' +
        '<td><input type="text" class="sr key"></td>\n' +
        '<td><input type="number" class="sr val"></td>\n' +
        '</tr>\n';
    for(var i=0;i<n;i++){
        $(obj).append(oneblank_html)
    }
}
function changequestionType(obj) {
    var type = $(obj).val();
    if(type == 1) {//填空题
        $("#addproblemCont").html(html_blank)
    }
    else if(type == 2) {//选择题
        $("#addproblemCont").html(html_choice)
    }
    else if(type == 3) {//判断题
        $("#addproblemCont").html(html_judge)
    }
    else if(type == 4) {//程序填空题
        $("#addproblemCont").html(html_procedureBlank)
    }
    else if(type == 5) {//程序改错题
        $("#addproblemCont").html(html_procedureError)
    }
    else if(type == 6) {//编程题
        $("#addproblemCont").html(html_desgin)
    }
}

//填空题提交
function blankSubmit() {
    var questionTitle = $("#questionTitle").val();
    var relateCourse = parseInt($("#relateCourse").val());
    var relateChapter = parseInt($("#relateChapter").val());
    var questionDifficulty = parseInt($("#questionDifficulty").val());
    var score = parseInt($("#score").val());
    var questionDescription = [];
    var questionAnswer=[];
    $(".BlankDes").each(function (i) {
        var _this=this;
        questionDescription.push({
            num: i+1,
            content:$(_this).val()
        });
    });
    $(".BlankAns").each(function (i) {
        var _this=this;
        questionAnswer.push({
            blankNumber: i+1,
            answer: $(_this).val()
        });
    });
    $.ajax({
        url: add_questionBlank_interface,
        type:'post',
        dataType:'json',
        contentType:"application/json",
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:JSON.stringify({
            questionTitle:questionTitle,
            relateCourse:relateCourse,
            relateChapter:relateChapter,
            score:score,
            questionDifficulty:questionDifficulty,
            questionDescription:questionDescription,
            questionAnswer:questionAnswer ,
        }),
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}
//判断题提交
function submitJudgeFun(){
    var questionTitle = $("#questionTitle").val();
    var testJudge = $("#testJudge").val();
    var relateCourse = parseInt($("#relateCourse").val());
    var relateChapter = $("#relateChapter").val()
    var questionDifficulty = parseInt($("#questionDifficulty").val());
    var rightAnswer = $("input[name='answer']:checked").val();
    var score = parseInt($("#score").val());
    var questionDescription = parseInt($("#questionDescription").val());
    $.ajax({
        url: add_questionJudge_interface,
        type:'post',
        dataType:'json',
        contentType:"application/json",
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:JSON.stringify({
            questionTitle:questionTitle,
            relateCourse:relateCourse,
            relateChapter:relateChapter,
            score:score,
            questionDifficulty:questionDifficulty,
            questionDescription:questionDescription,
            rightAnswer:rightAnswer
        }),
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}
//选择题提交
function submitChoiceFun(){
    var questionTitle = $("#questionTitle").val();
    var relateCourse = parseInt($("#relateCourse").val());
    var relateChapter = $("#relateChapter").val()
    var questionDifficulty = parseInt($("#questionDifficulty").val());
    var score = parseInt($("#score").val());
    var questionDescription = $("#questionDescription").val();
    var rightAnswer = $("#rightAns").val();
    var wrongAnswer = [];
    $(".wrongAns").each(function(i){
        var _this=this
        wrongAnswer.push(_this.value);
    });
    $.ajax({
        url: add_questionSelect_interface,
        type:'post',
        dataType:'json',
        contentType:"application/json",
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:JSON.stringify({
            questionTitle:questionTitle,
            relateCourse:relateCourse,
            relateChapter:relateChapter,
            score:score,
            questionDifficulty:questionDifficulty,
            questionDescription:questionDescription,
            rightAnswer:rightAnswer,
            wrongAnswer:wrongAnswer
        }),
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}
//程序填空题提交
function procedureBlankSubmit() {
    var questionTitle = $("#questionTitle").val();
    var relateCourse = parseInt($("#relateCourse").val());
    var relateChapter = parseInt($("#relateChapter").val());
    var questionDifficulty = parseInt($("#questionDifficulty").val());
    var score = parseInt($("#score").val());
    var questionDescription = [];
    var questionAnswer=[];
    var inputFormat=[];
    var outputFormat=[];
    var keyword=[];
    $(".BlankDes").each(function () {
        var _this=this;
        questionDescription.push($(_this).val());
    });
    $("#testdataTbody .inputs").each(function () {
        var _this=this;
        inputFormat.push($(_this).val());
    });
    $("#testdataTbody .outputs").each(function () {
        var _this=this;
        outputFormat.push($(_this).val());
    });
    $(".oneProcedureBlankCont").each(function (i) {
        var _this=this;
        questionAnswer.push({
            blankNumber: i+1,
            answer: $(_this).find(".BlankAns").val()
        });
        var keywordList=[]
        $(_this).find(".keywordTbody tr").each(function (i) {
            var _thiskeyword=this;
            keywordList.push({
                keywordNumber: i+1,
                keyword: $(_thiskeyword).find(".key").val(),
                score: $(_thiskeyword).find(".val").val()
            });
        });
        keyword.push({
            blankNumber: i+1,
            keywordList: keywordList
        })
    });
    $.ajax({
        url: add_questionProgramBlank_interface,
        type:'post',
        dataType:'json',
        contentType:"application/json",
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:JSON.stringify({
            questionTitle:questionTitle,
            relateCourse:relateCourse,
            relateChapter:relateChapter,
            score:score,
            questionDifficulty:questionDifficulty,
            questionDescription:JSON.stringify(questionDescription),
            questionAnswer:questionAnswer ,
            inputFormat: inputFormat,
            outputFormat:outputFormat ,
            keyword:keyword ,
        }),
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}
//编程题提交
function designSubmit() {
    var questionTitle = $("#questionTitle").val();
    var relateCourse = parseInt($("#relateCourse").val());
    var relateChapter = parseInt($("#relateChapter").val());
    var questionDifficulty = parseInt($("#questionDifficulty").val());
    var score = parseInt($("#score").val());
    var questionDescription = $("#questionDescription").val();
    var inputSampleFormat=[];
    var outputSampleFormat=[];
    var keyword=[];
    $("#testdataTbody .inputs").each(function (i) {
        var _this=this;
        inputSampleFormat.push({
            num: i+1,
            content: $(_this).val()
        });
    });
    $("#testdataTbody .outputs").each(function (i) {
        var _this=this;
        inputSampleFormat.push({
            num: i+1,
            content: $(_this).val()
        });
    });
    $(".keywordTbody tr").each(function (i) {
        var _thiskeyword=this;
        keyword.push({
            keywordNumber: i+1,
            keyword: $(_thiskeyword).find(".key").val(),
            score: $(_thiskeyword).find(".val").val()
        });
    });
    $.ajax({
        url: add_questionDesgin_interface,
        type:'post',
        dataType:'json',
        contentType:"application/json",
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:JSON.stringify({
            questionTitle:questionTitle,
            relateCourse:relateCourse,
            relateChapter:relateChapter,
            score:score,
            questionDifficulty:questionDifficulty,
            questionDescription:questionDescription,
            keyword:keyword ,
            inputSampleFormat:inputSampleFormat,
            outputSampleFormat:outputSampleFormat,
        }),
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}